<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
    <link rel="stylesheet" href="css/public.css" media="all">
    <script type="text/javascript" src="lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="js/jpetstore.js"></script>
</head>
<body>

<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" th:action="@{'/refreshOrder'}">
        <fieldset class="table-search-fieldset">
            <legend>搜索订单</legend>
            <div style="margin: 10px 10px 10px 10px" >
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">订单号</label>

                            <div class="layui-input-inline">
                                <input type="text" id="orderId" name="orderId" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" id="search" class="layui-btn layui-btn-primary" ><i class="layui-icon"></i> 搜 索</button>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" id="refresh" class="layui-btn layui-btn-primary"  ><i class="layui-icon"></i> 全部订单</button>
                        </div>
                    </div>
            </div>
        </fieldset>
        </form>
<!--        <form class="layui-form layui-form-pane" th:action="@{'/deleteOrder'}">-->
        <table class="layui-hide" id="orderTableId" lay-filter="orderTableFilter">
            <table class="layui-table">
                <tr>
                    <th>订单号</th>
                    <th>买家姓名</th>
                    <th>下单时间</th>
                    <th>收获地址</th>
                    <th>总价</th>
                    <th>是否发货</th>
                    <th>操作</th>
                </tr>
                <tr th:if="${orderList} eq null">
                    <td colspan="12">没有订单信息！！</td>
                </tr>
                <tr th:each="orders : ${orderList}">
                    <th th:text="${orders.orderId}"></th>
                    <th th:text="${orders.username}"></th>
                    <th th:text="${#dates.format(orders.orderDate,'yyyy-MM-dd')}"></th>
                    <th th:text="${orders.shipAddress1}"></th>
                    <th th:text="${orders.totalPrice}"></th>
                    <th th:switch="${orders.status}">
                        <div th:case="'P'" >
                            <button class="layui-btn layui-btn-normal layui-btn-xs " disabled="disabled" STYLE="background-color: #4b5461">
                                已出库
                            </button>
                        </div>
                        <div th:case="*">
                        <button class="layui-btn layui-btn-normal layui-btn-xs data-count-edit">
                            <a th:href="@{/changeOrderStatus(orderId=${orders.orderId})}">
                                出库
                            </a>
                        </button>
                        </div>
                    </th>

                    <th>
                        <button class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" >
                            <a th:href="@{/toEdit(orderId=${orders.orderId})}">
                            编辑
                            </a>
                        </button>
                        <button class="layui-btn layui-btn-xs layui-btn-danger data-count-delete">
                            <a th:href="@{/deleteOrder(orderId=${orders.orderId})}">
                            删除
                            </a>
                        </button>
                    </th>
                </tr>
            </table>
        </table>
<!--        </form>-->

<!--        <script type="text/html" id="currentTableBar">-->
<!--            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
<!--            <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
<!--        </script>-->

    </div>
</div>

</body>
</html>